import axios from "/@/utils/http/axios";
import {MethodEnum} from "/@/utils/http/axios/enum/method-enum";
import {CodeModel} from "/@/api/auth/model/LoginModel";


/**
 * 登录接口
 */
export function login(param: object, callBack?: Function) {
    return axios.httpRequest("/auth/login", MethodEnum.POST, param, {callBack, isToken: false});
}

/**
 * 获取验证码
 */
export function getCodeImage(callBack?: Function): Promise<CodeModel> {
    return axios.httpRequest("/auth/getCode", MethodEnum.GET, {}, {callBack, isToken: false})
}


/**
 * 获取用户信息
 */
export function selectLoginUserInfo(isHint: boolean, callBack?: Function) {
    return axios.httpRequest("/auth/selectLoginUserInfo", MethodEnum.GET, {}, {isHint, callBack});
}

/**
 * 注销当前用户
 */
export function logout(callBack?: Function): Promise<CodeModel> {
    return axios.httpRequest("/auth/logout", MethodEnum.GET, {}, {callBack})
}